A good answer might be:

Just one:

public void paint ( Graphics gr )

(However, the class inherits many more methods from class Applet).


Extending the Applet Class

The definition of Applet provides a framework for building an applet. By itself, the class Applet does little that is visible in the Web browser. (It does a great many things behind the scenes, however.)

To build upon this framework, you import java.applet.Applet and extend the Applet class:

import java.applet.Applet;
import java.awt.*;

public class AEHousman extends Applet
{
  public void paint ( Graphics gr )
  { 
    setBackground( Color.pink );
    gr.drawString("Loveliest of trees, the cherry now", 25, 30);
    gr.drawString("Is hung with bloom along the bough,", 25, 50);
    gr.drawString("And stands about the woodland ride", 25, 70 );
    gr.drawString("Wearing white for Eastertide." ,25, 90);
    gr.drawString("--- A. E. Housman" ,50, 130);
   }
}

When you extend a class, you are making a new class by building upon a base class. This example defines a new class called AEHousman. The new class has everything in it that the class Applet has. (This is called inheritance. Inheritance is discussed at greater length in chapter 50.)

The class Applet has a paint() method, but that method does little. Objects of class AEHousman have their own paint() method because the definition in AEHousman.java overrides the one in Applet.

The Web browser calls the paint() method when it needs to "paint" the section of the monitor screen devoted to an applet. Each applet that you write has its own paint() method.

QUESTION 3:

Pretend that the Web browser has just called the paint() method. The first statement in the method is:

setBackground( Color.pink );

What do you suppose that this does?